<%--
  Created by IntelliJ IDEA.
  User: l
  Date: 2022/5/2
  Time: 18:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="menu.jsp"%>
<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="/admin/admin_index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户管理</span></div>
    </div>
    <div class="result-wrap">
        <form name="myform" id="myform" method="post">
            <div class="result-content">
                <table class="result-tab" width="100%">
                    <tr>
                        <th>ID</th>
                        <th>昵称</th>
                        <th>实名</th>
                        <th>账号</th>
                        <th>密码</th>
                        <th>卡号</th>
                        <th>账号状态</th>
                        <th>操作</th>
                    </tr>
                    <%--从后台获取的数据循环--%>
                    <c:forEach var="u" items="${userList}">
                        <%--不展示被删除用户--%>
                        <c:if test="${u.state != 2}">
                            <tr>
                                <td>${u.id}</td>
                                <td>${u.netname}</td>
                                <td>${u.turename}</td>
                                <td>${u.number}</td>
                                <td>......</td>
                                <td>${u.bankCard}</td>
                                <td>
                                    <c:if test="${u.state == 0}">正常</c:if>
                                    <c:if test="${u.state == 1}">已封号</c:if>
                                    <c:if test="${u.state == 3}">待通过</c:if>
                                </td>
                                <td>
                                    <a class="link-update" href="/admin/admin_selectUser?id=${u.id}&cp=${page}">修改</a>
                                    <a class="link-del" href="javascript:Delete('你确定要删除用户【${u.netname}】吗？','/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=2')">删除</a>
                                    <c:if test="${u.state == 1}">
                                        <a class="link-update" href="javascript:Delete('你确定要解封用户【${u.netname}】吗？','/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=1')">解封</a>
                                    </c:if>
                                    <c:if test="${u.state == 3}">
                                        <a class="link-update" href="javascript:Delete('你确定要通过用户【${u.netname}】注册吗？','/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=3')">通过注册</a>
                                    </c:if>
                                    <c:if test="${u.state == 0}">
                                        <a class="link-update" href="javascript:Delete('你确定要封掉用户【${u.netname}】吗？','/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=0')">封号</a>
                                    </c:if>
                                    <c:if test="${u.admin != 1}">
                                        <a class="link-update" href="/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=5">设为管理员</a>
                                    </c:if>
                                    <c:if test="${u.admin != 0 and u.id != 1}">
                                        <a class="link-update" href="/admin/admin_deleteUser?id=${u.id}&cp=${page}&cz=6">取消管理员</a>
                                    </c:if>
                                </td>
                            </tr>
                        </c:if>
                    </c:forEach>
                    <script>
                        //提示
                        function Delete(mess,url){
                            if(confirm(mess)){
                                location.href=url;
                            }
                        }
                    </script>
                </table>
                <div class="list-page">
                    <a href="/admin/admin_index?cp=1">首页</a>
                    <c:if test="${page != 1}"><a href="/admin/admin_index?cp=${page-1}">上一页</a></c:if>
                    ${sum} 条 ${page}/${cpage} 页
                    <c:if test="${page != cpage}"><a href="/admin/admin_index?cp=${page+1}">下一页</a></c:if>
                    <a href="/admin/admin_index?cp=${cpage}">尾页</a>
                </div>
            </div>
        </form>
    </div>
</div>
<!--/main-->
</div>
</body>
</html>